package com.mer.controller;

import com.mer.service.CourseReviewService;
import com.mer.vo.CommonResult;
import com.mer.vo.CourseReviewVo;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.time.LocalDateTime;

/**
 * @program: IIPhase-project
 * @description: 课程审核控制层
 * @author: 陈铠
 * @create: 2021-10-21 14:35
 **/
@RestController
@RequestMapping("/core/reviewCourse")
public class CourseReviewController {
    @Resource
    private CourseReviewService courseReviewService;

    @PostMapping("/checkCourse/{page}/{limit}")
    @ApiOperation("分页查询课程审核的接口")
    public CommonResult selectReviewCourse(@PathVariable Integer page, @PathVariable Integer limit, @RequestBody CourseReviewVo courseReviewVo) {
        return courseReviewService.selectTobeReviewedCourse(page, limit, courseReviewVo);
    }

    @PostMapping("/modifyCourseCheck")
    @ApiOperation("审核课程接口")
    public CommonResult modifyCourseCheck(@RequestBody CourseReviewVo courseReviewVo) {
        LocalDateTime now = LocalDateTime.now();
        courseReviewVo.setCheckTime(now.toString());
        return courseReviewService.modifyCourseCheck(courseReviewVo);
    }
}
